#include "VGPLib.h"

using namespace cocos2d;

VGPClip* VGPClip::instance;


VGPClip* VGPClip::getInstance()
{
	if ( instance == NULL )
		instance = new VGPClip();
	return instance;
}

CCClippingNode* VGPClip::createClip( CCPoint position , CCSize size, cocos2d::CCNode* node, int zOrder, int tag )
{
	CCClippingNode *clip = CCClippingNode::create();
	clip->setPosition ( position );
	clip->setContentSize ( size );
	clip->setSize ( size );
	clip->setZOrder ( zOrder );
	clip->setTag ( tag );
	clip->addChild ( node );
	return clip;
}

CCClippingNode* VGPClip::createClip( CCPoint position , CCSize size, cocos2d::CCNode* node, int zOrder )
{
	return createClip( position , size, node, zOrder, -1 );
}

CCClippingNode* VGPClip::createClip( CCPoint position , CCSize size, cocos2d::CCNode* node )
{
	return createClip( position , size, node, 0 );
}

void VGPClip::addClip( cocos2d::CCLayer* layer, cocos2d::CCPoint position , cocos2d::CCSize size, cocos2d::CCNode* node, int zOrder, int tag )
{
	layer->addChild ( createClip ( position, size, node, zOrder, tag ) );
}

void VGPClip::addClip( cocos2d::CCLayer* layer, cocos2d::CCPoint position , cocos2d::CCSize size, cocos2d::CCNode* node, int zOrder )
{
	addClip( layer, position , size, node, zOrder );
}

void VGPClip::addClip( cocos2d::CCLayer* layer, cocos2d::CCPoint position , cocos2d::CCSize size, cocos2d::CCNode* node )
{
	addClip( layer, position , size, node, 0 );
}